Repository navigation
fix(toolchains): version permission and authority error codes - #182
Merged
Merged
Conversation
…260-toolchain-error-codes # Conflicts: # shared/plugins/reference/protocol-changelog.md
1lck
marked this pull request as ready for review
November 23, 2026 13:26
This was referenced Nov 28, 2026
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 29, 2026
* docs(plugins): 协议更新记录把已合入的 PR 移进时间线并回填日期(#222) “待合入”一节的 20 条记录(含 #224)对应的 PR 都已合入 main,按 UTC 合入日期改成时间线表格行,原文逐句保留,只删去“合入日期在合并时补齐” 之类的占位句;#193 已在时间线里,删去重复的待合入条目。新增 2026-11-24、 2026-11-22 两个日期分组。 - 回填“按协议查首次出现”的市场增量索引 schemaVersion 0(#187)、 toolchainProviders 1 与 litheToolchains 1(#182),以及“宿主方法 (按 API 编号)”里 #194、#190、#183、#151 的 18 个方法日期。 - 补录改了契约却没有登记的 #177、#117、#26。 - #207 的修改人按 PR 作者改为 devin-ai-integration[bot]。 - 时间线表头和维护说明统一用“改动”;转义 #133 行内代码里的竖线, 避免表格多出一列。 * docs(plugins): 已有宿主方法加字段也在方法表补行,统一方法表写法(#222) “宿主方法(按 API 编号)”表给 5 个 PR 补了 13 行,都是给已有方法或通知加字段、改校验时漏登记的: - #151:workspace/listContexts、workspace/getContext(authority 新增 platform),functions/invoke(转发远程工作区上下文的调用) - #184:API-11 的 7 个方法(路由前严格校验参数;workspace/create 的 kind 新增 symlink 与 linkTarget) - #188:editor/registerProviders(新增 colorDecorations) - #198:editor/registerActions(actionIcons 新增 4 个导航图标 token) - #224:agents/didPrompt(有附件时带 attachments) 统一写法:方法列只写方法名,补了什么写在协议列的括号里(#193 的 openHTML、openExternal,#23、#128 的 run/start,#128 的 prepareRun);同一个方法的各行排在一起,首次记录在前。 表格说明、维护第 3 步和 API PR 提交指南第 4 步写明:给已有方法或通知加参数、返回字段或取值,或改执行、校验行为,都在索引另加一行;API 总表不加行,用途、权限或协议变了就改原来那一行。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与复现
工具链提供者的权限/authority 错误和插件函数中转共用了 JSON-RPC
-32070/-32071。旧能力版本已经发布,直接更换旧版号码会破坏现有提供者。在旧基线
4880022be16c862c6faa6ac18e13c0de61432177上先加入回归:合法的版本 1 权限应答被拒为plugin.api.unsupported,预期是plugin.toolchain.permissionDenied,修复前测试失败。另通过未改生产代码的 C ABI 实跑四条对照,确认数字冲突成立。实测也澄清了 Issue 中的一个影响描述:Core 原先已严格校验
error.data.code和请求身份,原样转发的plugin.function.failed/plugin.function.invalidResult会得到plugin.toolchain.invalidReply,不会被接受为权限/authority 错误。本次修复的是跨协议的数字重号。改动与兼容性
toolchainProviders: 0toolchainProviders: 1plugin.toolchain.permissionDenied-32070-32082plugin.toolchain.authorityUnsupported-32071-32083toolchainProviders: 1/litheToolchains版本 1;权限/authority 错误改为独立数字-32082/-32083(避开已在main合入的 feat(plugins): 插件后端可保存、关闭文档和新建、重命名、复制、移到废纸篓(API-11) #183 宿主错误码-32080plugin.host.alreadyExists与-32081plugin.host.diskChanged),稳定字符串码与其余数字保持不变。Core 从重新校验的清单构造 provider 的version,据此解码,两个版本互相拒绝对方的号码。rpc_code的版本 0 语义,新增显式的rpc_code_for_version。四个 SDK 的公开plugin.function.*和plugin.host.*映射不变。Backend::toolchain_provider调用继续使用版本 0,单独升级/重编 SDK 不会改变已发布插件的协议。声明版本 1 的插件显式调用toolchain_provider_version(ToolchainProviderVersion::V1);旧宿主未提供版本 1 时不启用提供者。rust/fixtures/toolchains/error-code-versions.json共 15 项 fixture 覆盖旧版、新版、跨版本混码拒绝、宿主-32080/-32081拒绝、函数错误转发拒绝和未知能力版本。补充宿主能力准入、LSP 协商、lithe_plugin_rpc::codes全部服务端/中转/宿主号码唯一性校验、SDK 源码兼容与真实 SDK/Core 错误传输回归。当前桌面端声明
toolchainProviders版本 0,继续兼容;本 PR 不升级桌面端 Core pin 或启用桌面端版本 1。现有 Go 消费者通过json.Unmarshal读取 registry,允许新增的 providerversion字段。验证
已合并最新
origin/main(9c8e89a)并解决冲突及-32080/-32081撞号问题,当前本地验证提交为e2ff09c932a9d62cd04a84a03401fa4557d4cea4(macOS,rustc 1.100.0):cargo fmt --manifest-path rust/Cargo.toml --all -- --check与cargo fmt --manifest-path shared/plugins/sdk/rust/Cargo.toml --all -- --check通过,git diff --check origin/main HEAD通过。node --test scripts/rust-core/*.test.mjs(16/16)、node scripts/rust-core/verify-platform-tests.mjs(52 crates)、node scripts/logging/generate-log-events.mjs --check(149 events)、verify-test-stability.sh --base origin/main、./scripts/rust-core/verify-rust-core-comments.sh(全部工作区 crate)通过。cargo clippy --locked --manifest-path rust/Cargo.toml --workspace --all-targets --all-features -- -D warnings与LIBSQLITE3_SYS_USE_PKG_CONFIG=1 cargo clippy --locked --manifest-path rust/Cargo.toml --workspace --all-targets --target x86_64-pc-windows-msvc -- -D warnings通过。node scripts/rust-core/affected-crates.mjs --base origin/main选中--workspace --features lithe-remote/server,lithe-remote/motty;在 macOS 上完整执行env -u GIT_EDITOR cargo test --locked --manifest-path rust/Cargo.toml --workspace --features lithe-remote/server,lithe-remote/motty:2664 通过、0 失败、0 忽略(共 126 个测试/文档测试套)。shared/plugins与四 SDK 本地验证:node --test shared/plugins/scripts/*.test.mjs(2/2)、node shared/plugins/scripts/verify-docs.mjs通过。node --test shared/plugins/sdk/node/test/*.test.mjs89/89 通过(未在本地安装node_modules,test:types留待 CI)。gofmt -l shared/plugins/sdk/go、go -C shared/plugins/sdk/go vet ./...、go -C shared/plugins/sdk/go test ./...与test -race ./...通过。rustc 1.100.0):cargo test --locked --manifest-path shared/plugins/sdk/rust/Cargo.toml91/91 通过(90 单测/集成 + 1 文档测试)、cargo clippy --all-targets -- -D warnings通过(本地未安装rustc 1.87.0,MSRV 留待 CI)。mvn -B -ntp -f shared/plugins/sdk/java/pom.xml verify80/80 通过并构建两个样例 jar(本地 JDK 17;Java 8 运行时留待 CI)。node shared/plugins/scripts/sdk-e2e.mjs12/12 通过(包括真实 Rust 版本 1 提供者返回-32082经 Core 解码为plugin.toolchain.permissionDenied)。Linux 与 Windows 原生运行测试、
rustc 1.87.0、Java 8运行时与 Nodetest:types未在本机运行,交由 CI 验证;桌面宿主版本 1 集成不属本 PR 范围。Refs 1lck/Lithe-IDEA#2260